package com.one.blocks.rbac.enums;

import com.one.blocks.common.enums.CodeEnum;
import com.one.blocks.common.valid.validator.EnumContainsValid;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author linfuxin Created on 2022-02-14 10:39:05
 */
@Getter
@AllArgsConstructor
public enum MenuTypeEnum implements CodeEnum, EnumContainsValid<Integer> {

    /**
     * 目录
     */
    FOLDER(0),

    /**
     * 菜单
     */
    MENU(1),

    /**
     * 按钮
     */
    BUTTON(2),
    ;

    private final int code;

    @Override
    public boolean contains(Integer val) {
        return Arrays.stream(values()).anyMatch(i -> i.getCode() == val);
    }
}
